package com.xiaolei.library.Widgets;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;

/**
 * 不可滚动的ViewPager
 */
public class NoScrollViewPager extends ViewPager
{
    public boolean disabel = false;

    public NoScrollViewPager(@NonNull Context context)
    {
        this(context, null);
    }

    public NoScrollViewPager(@NonNull Context context, @Nullable AttributeSet attrs)
    {
        super(context, attrs);
    }


    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev)
    {
        return disabel && super.onInterceptTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev)
    {
        return disabel && super.onTouchEvent(ev);
    }
}
